import com.sun.jdi.event.ThreadStartEvent;

    public class Demo1 {
        public static void main(String[] args) throws InterruptedException {
            Thread t1=new Thread(()->{
            while(true){
                System.out.println("Hello t1");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            });
            Thread t2=new Thread(()->{
                while(true){
                    System.out.println("Hello t2");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            });
            t1.setDaemon(true);
            t1.start();
            t2.start();
            System.out.println("t1线程是否为后台线程"+t1.isDaemon());
            System.out.println("t2线程是否为后台线程"+t2.isDaemon());

        }
    }